package com.promis.party.ui.partywork.dailywork.taskassignment;

import android.content.Context;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

import com.promis.party.R;

import java.util.List;

public class TaskAssignmentRecordListAdapter extends RecyclerView.Adapter<TaskAssignmentRecordListAdapter.ViewHolder> {

    private Context context;
    private OnItemClickListener onItemClickListener;
//    private List<Receipt> receiptList;

    public TaskAssignmentRecordListAdapter(Context context) {
        this.context = context;
    }

    @Override
    public ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
        View view = LayoutInflater.from(context).inflate(R.layout.adapter_task_assignment_record, parent, false);
        return new ViewHolder(context, view, onItemClickListener);
    }

    @Override
    public void onBindViewHolder(ViewHolder holder, int position) {
//        if(CollectionUtils.isNullOrEmpty(receiptList)) return;

    }

    @Override
    public int getItemCount() {
//        if (CollectionUtils.isNullOrEmpty(receiptList)) return 0;
//        else return receiptList.size();
        return 3;
    }

    public void notifyDataSetChanged(List<String> receiptTradeList) {
//        this.receiptList = receiptTradeList;
        super.notifyDataSetChanged();
    }

    public void setOnItemClickListener(OnItemClickListener onItemClickListener) {
        this.onItemClickListener = onItemClickListener;
    }

    class ViewHolder extends RecyclerView.ViewHolder {


        public ViewHolder(Context context, View view, final OnItemClickListener listener) {
            super(view);

            view.setOnClickListener(new View.OnClickListener() {
                @Override
                public void onClick(View v) {
                    if (onItemClickListener != null) onItemClickListener.onClickComment(v, getLayoutPosition());
                }
            });
        }
    }

    public static interface OnItemClickListener {

        void onClickComment(View view, int position);
    }
}
